package main

import (
	"fmt"
	"net/http"
)

func sayHello(w http.ResponseWriter, r *http.Request) {
	hello := []byte("hello, world")
	fmt.Println("=============================================-")
	fmt.Println("header")
	fmt.Println(r.Header)
	fmt.Println("=============================================-")
	fmt.Println("host")
	fmt.Println(r.Host)
	fmt.Println("=============================================-")
	fmt.Println("agent")
	fmt.Println(r.UserAgent())
	fmt.Println("=============================================-")
	fmt.Println("method")
	fmt.Println(r.Method)
	fmt.Println("=============================================-")
	fmt.Println("url")
	fmt.Println(r.URL)
	fmt.Println("=============================================-")
	fmt.Println("proto")
	fmt.Println(r.Proto)
	fmt.Println(r.ProtoMajor)
	fmt.Println(r.ProtoMinor)
	fmt.Println("=============================================-")
	fmt.Println("TransferEncoding")
	fmt.Println(r.TransferEncoding)
	fmt.Println("=============================================-")
	fmt.Println("contentlength")
	fmt.Println(r.ContentLength)
	fmt.Println("=============================================-")
	fmt.Println("close")
	fmt.Println(r.Close)

	w.WriteHeader(http.StatusOK)
	w.Write(hello)
	return
}

func main() {
	http.HandleFunc("/", sayHello)
	http.ListenAndServe(":8001", nil)

}
